package com.tzy.dishes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tzy.common.entity.Dishes;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;
/**
 * <p>
 * 菜品详细表 Mapper 接口
 * </p>
 *
 * @author 谭同学
 * @since 2022-03-06
 */
public interface DishesMapper extends BaseMapper<Dishes> {
    List<Dishes> findDishesListByShopId(int shopId);
    /**
     * 根据菜品模糊查询菜品列表
     * @param dishesName
     * @param pageNum
     * @param size
     * @return
     */
    @MapKey("id")
    List<Dishes> findFuzzyQueryDishesListPageByDishesName(String dishesName, Integer pageNum, Integer size);
    @MapKey("id")
    List<Map<String, Object>> findAllDishesListMapsPageByDishesName(String dishesName, Integer pageNum, Integer size);
    /**
     * 连表查询
     * @param dishesTypeId
     * @param pageNum
     * @param size
     * @return
     */
    @MapKey("id")
    List<Map<String,Object>> findAllMapsPageByTypeId(int dishesTypeId, Integer pageNum, Integer size);

    List<Dishes> findAllListByTypeIdPage(int dishesTypeId,Integer pageNum,Integer size);
    @Select(" select count(1) from dishes where is_deleted = 0 ")
    int findTotal();

}
